﻿<Window x:Class="Sustainalytics.Download.View.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="MainWindow" Height="550" Width="825">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Margin="10">
            <TextBlock Text="Include Product Involvement Files Only: " />
            <CheckBox IsChecked="{Binding GetProductInvolvementFilesOnly, Mode=TwoWay}" />
        </StackPanel>
        <TextBlock Margin="10" Grid.Row="1" >
            <Run Text="No. of files: " />
            <Run Text="{Binding FilesCount, Mode=OneWay}" />
        </TextBlock>
        <ListView Grid.Row="2" HorizontalAlignment="Stretch" Margin="10" VerticalAlignment="Stretch" ItemsSource="{Binding FileList}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="350" />
                    <GridViewColumn Header="Date" DisplayMemberBinding="{Binding UploadDate}" Width="150" />
                    <GridViewColumn Header="Download" Width="100">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button x:Name="downloadButton" CommandParameter="{Binding Id}" Command="{Binding DataContext.DownloadCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Content="Down" Padding="2" Margin="2" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="10" Grid.Row="3" >
            <Button CommandParameter="-1" Command="{Binding DataContext.ChangePageCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Content="←" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <TextBlock Text="{Binding Page}" FontWeight="Bold" FontSize="16" Padding="10, 4" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Button CommandParameter="1" Command="{Binding DataContext.ChangePageCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Content="→" FontWeight="Bold" FontSize="16" Padding="4" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </StackPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="10" Grid.Row="3">
            <TextBlock Text="Page Size:" 
                       HorizontalAlignment="Left" 
                       VerticalAlignment="Center" />
            <ComboBox Width="100" Margin="10"
                      HorizontalAlignment="Left" 
                      VerticalAlignment="Center" 
                      ItemsSource="{Binding PageSizes}" 
                      SelectedItem="{Binding Take, Mode=TwoWay}" />
        </StackPanel>
    </Grid>
</Window>
